# -*- coding: utf-8 -*-
"""
@Time ： 2025/8/27 14:58
@Auth ： 李天天
"""
import time

from PageLocators.MainPage_locator import MainPageLocator as loc

from Common.basepage import BasePage


class MainPage(BasePage):
    def click_movie(self):
        self.click_by_text("电影", tag="span")

    def click_channel(self, channel_name):
        self.click_by_text(text=channel_name, tag="span", img_desc=f"主页_点击{channel_name}tab")

    def click_personal_center(self):
        self.click_element(loc.personal_center, img_desc="主页_点击个人中心")

    def click_back_top(self):
        self.click_element(loc.back_top_loc, img_desc="主页_点击回到顶部")

    def click_filter(self):
        self.click_by_text("筛选", tag="span", img_desc="主页_点击筛选")
    def click_back(self):
        self.click_element(loc.back_loc, img_desc="筛选页_点击返回")

    def click_search(self):
        self.click_element(loc.search_loc,img_desc="主页_点击搜索")

    def click_history(self):
        self.click_element(loc.history_loc,img_desc="主页_点击历史")

    def click_first_movie(self):
        self.click_element(loc.first_movie_loc,img_desc="主页_点击第一个电影")

if __name__ == '__main__':
    from Common.browser_config import quick_start

    pw, browser, context, page = quick_start(auto_login=True)
    main_page = MainPage(page)
    # main_page.goto("https://www.iqiyi.com/iv0401#/?ver=tesla")
    main_page.goto("https://www.iqiyi.com/iv#/?ver=tesla")
    time.sleep(5)
    main_page.click_personal_center()
    time.sleep(5)
    time.sleep(10)
